{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 图像分割SegNet\n",
    "\n",
    "### 相关参考\n",
    "- github链接：https://github.com/chainer/chainercv\n",
    "- 官方文档链接：http://chainercv.readthedocs.io/en/stable/index.html\n",
    "- 预训练模型下载页面：https://github.com/yuyu2172/share-weights/releases/\n",
    "- SegNet参考的caffe实现及预训练模型：http://mi.eng.cam.ac.uk/projects/segnet/tutorial.html\n",
    "\n",
    "\n",
    "由chainercv自带的预训练模型\n",
    "\n",
    "\n",
    "### 采用的数据集为：camvid\n",
    "\n",
    "- 数据集类别camvid_label_names：'Sky',  'Building',  'Pole',  'Road',  'Pavement',  'Tree',  'SignSymbol',  'Fence',  'Car',  'Pedestrian',  'Bicyclist'\n",
    "- 不同类别的颜色camvid_label_colors：(128, 128, 128),  (128, 0, 0),  (192, 192, 128),  (128, 64, 128),  (60, 40, 222),  (128, 128, 0),  (192, 128, 128),  (64, 64, 128),  (64, 0, 128),  (64, 64, 0),  (0, 128, 192)\n",
    "\n",
    "\n",
    "### 其中需要注意的是：\n",
    "\n",
    "- (1)'pip install chainercv'好像没有load进去vis_semantic_segmentation模块，所以我的做法是从github中加到：/usr/local/lib/python3.5/dist-packages/chainercv/visualizations目录下（github该模块链接：https://github.com/chainer/chainercv/tree/master/chainercv/visualizations）\n",
    "- (2)读图的时候，注意最好使用chainercv自带的读入函数utils.read_image"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import argparse\n",
    "import matplotlib.pyplot as plot\n",
    "import chainer\n",
    "from chainercv.datasets import camvid_label_colors\n",
    "from chainercv.datasets import camvid_label_names\n",
    "from chainercv.links import SegNetBasic\n",
    "from chainercv import utils\n",
    "from chainercv.visualizations import vis_image\n",
    "from chainercv.visualizations.vis_semantic_segmentation import vis_semantic_segmentation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAACkCAYAAACHKtXIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJztnXmUZVV977/7znVrrp5HupllEGgaBNFH28ygiC9GRRPR\nkKDGGBNN1GT53qq86ApJ1lIjxiQ8caXzlgkSBukASphaBpmaBkGm7gaaprurhxpvVd353v3+OOfu\n37eoW123qqtu1T38Pmux+lf7nrPPPucezt3nu3+DsdZCURRFaXxCcz0ARVEUZWbQB7qiKEpA0Ae6\noihKQNAHuqIoSkDQB7qiKEpA0Ae6oihKQNAHuqIoSkA4oge6MeZSY8yrxpidxphvzNSgFGWu0Xtb\naUTMdAOLjDFhANsBXARgD4CnAVxtrX1p5oanKPVH722lUYkcwb5nA9hprX0dAIwxNwP4MIAJb/rO\nroV2+crV/l/yQ2KM8Vrox2XMD43/OQAUCwVnj4wMOzubyR52sMuWLR13PAAolUpV290xRkedHY3K\n5SoWi86OxaLODoXC4/rgczGGXoosb8PNdtznY8Y20Y8wbVJGyW+SRjtBf7ZM46vaH207waC5nfuo\nbDL2GvCYqvcx9hS9P0IhuXbl8vj9+g4dxEgqNf5LnDpTureTSWM7OqZ+kNbWZdMa3PDw5NtUP96R\n9zHTjB1TTw17TO+aNTo9PT291tpFk213JA/0FQDeor/3AHjP4XZYvnI1br7nYQBAuVx27TH/QckP\nSbb5AdB7cL+zH3nkEWe//OJL/rbVH3bf/Et5a45E5LRTqSEZRyw27niPPfG4sxcvXujsvr4+Z69c\ntdzZLf4dyg+qUknscCjmbLoEKMrvlHtYlQpyDeLxuHxO7RbSCY87a1Le8cJR2k+2jYTkGuRz0l8Y\n9INkyn4f0lYoy0BLpSLZ0s7bF4teH6W8fM4/evw9l+hcCtR35VomEgnXlsvl6Njej9e3//LPMENM\n6d7u6AA+97mpH2TDhmnsBGDLlmnthg0bjryPmWbsmLpr2GN616zR6e7ufrOW7WZ9UdQYc50xZqsx\nZutAf+9sH05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1yXo5wc0+DnWXUNXFEVRZgeVXBRFUQJCXR/oxphLjTGvGmN2\nGmO+Uc9jzwbGmFXGmIeMMS8ZY140xnzZb+8yxtxnjNnh/9s5WV/zGWNM2BjzrDHmLv/vtcaYJ/3v\n8afGmHd0iGbQ7mtA7+1Gvbfr9kA3xoQB/COAywCcBOBqY8xJ9Tr+LFEE8FVr7UkAzgHwRf+cvgHg\nAWvtcQAe8P9uZL4M4GX6+28BfNdaeyyAAQDXzsmo5gEBva8Bvbcb8t6u5wz9bAA7rbWvW2vzAG4G\n8OE6Hn/Gsdb2WGu3+fYwvBtjBbzzqlTo2ATgqrkZ4ZFjjFkJ4AoAP/L/NgA2ArjV36Shz28GCNx9\nDei97W/ScOdXzwf6CgBv0d97/LZAYIxZA+AMAE8CWGKtrZTl2Q9gyQS7NQLfA/A1wGXfWgBg0Fpb\nSTAfqO9xGgT6vgb03p6LgU0XXRSdAYwxLQBuA/An1toUf2Y9N6KGdCUyxnwQwEFr7TNzPRZlbtB7\nu7GoZ/rcvQBW0d8r/baGxhgThXfD/8RaW8lle8AYs8xa22OMWQbg4NyN8Ig4D8CVxpjLASQAtAH4\nBwAdxpiIP5MJxPd4BATyvgb03kYDfpf1nKE/DeA4fxU5BuATADZPss+8xtfcbgLwsrX2O/TRZgDX\n+PY1AO6s99hmAmvtX1hrV1pr18D7vh601n4KwEMAPupv1rDnN0ME7r4G9N72N2u486vbA93/xfsj\nAPfCW2C5xVr7Yr2OP0ucB+B3AWw0xjzn/3c5gOsBXGSM2QHgQv/vIPF1AF8xxuyEpzveNMfjmTMC\nel8Dem835L2tkaKKoigBQRdFFUVRAoI+0BVFUQKCPtAVRVECgj7QFUVRAoI+0BVFUQKCPtAVRVEC\ngj7QFUVRAoI+0BVFUQLC/weFXNVgC+gHoAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7fa6302c57f0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# pre-model + read picture\n",
    "img = utils.read_image('///../46.jpg', color=True)\n",
    "model = SegNetBasic(n_class = 11,pretrained_model  = 'camvid')\n",
    "labels = model.predict([img])\n",
    "\n",
    "# plot\n",
    "label = labels[0]  # (332, 500)\n",
    "fig = plot.figure()\n",
    "ax1 = fig.add_subplot(1, 2, 1)\n",
    "vis_image(img, ax=ax1)\n",
    "ax2 = fig.add_subplot(1, 2, 2)\n",
    "vis_semantic_segmentation(label, camvid_label_names, camvid_label_colors, ax=ax2)\n",
    "plot.show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
